﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="RoleClassCollectionViewModel.cs" >
//   J. Prinz
// </copyright>
// <summary>
//   The RolesCollectionViewModel is a collection of RoleClass-ViewModels and implements the
//   ViewModel for the Representation of a List of CAEX-RoleClassType-Objects
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace AutomationMLMapper.ViewModels.CAEXObjectCollectionViewModels
{
    using AutomationMLMapper.Properties;
    using AutomationMLMapper.ViewModels.CAEXObjectViewModels;

    /// <summary>
    ///   The RolesCollectionViewModel is a collection of RoleClass-ViewModels and implements the
    ///   ViewModel for the Representation of a List of CAEX-RoleClassType-Objects
    /// </summary>
    public class RoleClassCollectionViewModel : CAEXObjectCollectionViewModel<RoleClassViewModel>
    {
        #region Fields

        /// <summary>
        ///  <see cref="ExpandRoleAttributes"/>
        /// </summary>
        private bool expandRoleAttributes;

        /// <summary>
        ///    <see cref="ShowRoleAttributes"/>
        /// </summary>
        private bool showRoleAttributes;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="RoleClassCollectionViewModel"/> class. 
        /// </summary>
        /// <param name="parent">
        /// the view Model of the Parent Caex-Object 
        /// </param>
        public RoleClassCollectionViewModel(ICAEXObject parent)
            : base(parent)
        {
            this.ShowRoleAttributes = false;
        }

        #endregion

        #region Public Properties

        /// <summary>
        ///   DisplayName of the Collection in the UI used in Headers and Labels
        /// </summary>
        public new string DisplayName
        {
            get
            {
                return Resources.RoleClasses;
            }
        }

        /// <summary>
        ///   Expansion state of the Attributes of the RoleClasses of the collection
        /// </summary>
        public bool ExpandRoleAttributes
        {
            get
            {
                return this.expandRoleAttributes;
            }

            set
            {
                this.expandRoleAttributes = value;
                foreach (var roleClass in this.Elements)
                {
                    roleClass.AttributesCollection.IsExpanded = value;
                }

                this.OnNotifyPropertyChanged("ExpandRoleAttributes");
            }
        }

        /// <summary>
        ///   Visibility of the Attributes of the RoleClasses of the collection
        /// </summary>
        public bool ShowRoleAttributes
        {
            get
            {
                return this.showRoleAttributes;
            }

            set
            {
                this.showRoleAttributes = value;
                this.OnNotifyPropertyChanged("ShowRoleAttributes");
            }
        }

        #endregion
    }
}